Don't filter control-shift+[non-hex]. (#80252, reported by Nalin
authorOwen Taylor <otaylor@redhat.com>
Thu, 16 May 2002 19:40:59 +0000 (19:40 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 16 May 2002 19:40:59 +0000 (19:40 +0000)
Tue May  7 15:50:51 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
        Don't filter control-shift+[non-hex].
        (#80252, reported by Nalin Dahyabhai)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkimcontextsimple.c

index aac856524c52c1fd3d25ea383aed85a46103a78b..87841e393469636b1abea191d48f74ec7ff15567 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue May  7 15:50:51 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
+       Don't filter control-shift+[non-hex]. 
+       (#80252, reported by Nalin Dahyabhai)
+
 Thu May 16 14:51:14 2002  Owen Taylor  <otaylor@redhat.com>
 
        Fixes for #78258
index aac856524c52c1fd3d25ea383aed85a46103a78b..87841e393469636b1abea191d48f74ec7ff15567 100644 (file)
@@ -1,3 +1,9 @@
+Tue May  7 15:50:51 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
+       Don't filter control-shift+[non-hex]. 
+       (#80252, reported by Nalin Dahyabhai)
+
 Thu May 16 14:51:14 2002  Owen Taylor  <otaylor@redhat.com>
 
        Fixes for #78258
index aac856524c52c1fd3d25ea383aed85a46103a78b..87841e393469636b1abea191d48f74ec7ff15567 100644 (file)
@@ -1,3 +1,9 @@
+Tue May  7 15:50:51 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
+       Don't filter control-shift+[non-hex]. 
+       (#80252, reported by Nalin Dahyabhai)
+
 Thu May 16 14:51:14 2002  Owen Taylor  <otaylor@redhat.com>
 
        Fixes for #78258
index aac856524c52c1fd3d25ea383aed85a46103a78b..87841e393469636b1abea191d48f74ec7ff15567 100644 (file)
@@ -1,3 +1,9 @@
+Tue May  7 15:50:51 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
+       Don't filter control-shift+[non-hex]. 
+       (#80252, reported by Nalin Dahyabhai)
+
 Thu May 16 14:51:14 2002  Owen Taylor  <otaylor@redhat.com>
 
        Fixes for #78258
index aac856524c52c1fd3d25ea383aed85a46103a78b..87841e393469636b1abea191d48f74ec7ff15567 100644 (file)
@@ -1,3 +1,9 @@
+Tue May  7 15:50:51 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
+       Don't filter control-shift+[non-hex]. 
+       (#80252, reported by Nalin Dahyabhai)
+
 Thu May 16 14:51:14 2002  Owen Taylor  <otaylor@redhat.com>
 
        Fixes for #78258
index aac856524c52c1fd3d25ea383aed85a46103a78b..87841e393469636b1abea191d48f74ec7ff15567 100644 (file)
@@ -1,3 +1,9 @@
+Tue May  7 15:50:51 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress):
+       Don't filter control-shift+[non-hex]. 
+       (#80252, reported by Nalin Dahyabhai)
+
 Thu May 16 14:51:14 2002  Owen Taylor  <otaylor@redhat.com>
 
        Fixes for #78258
index 4a2c99a6d913242c5a863227db7ebb95ddea05af..ee15be780a872fc3b102f014df2062145e3bbc34 100644 (file)
@@ -1103,10 +1103,9 @@ canonical_hex_keyval (GdkEventKey *event)
   if (keyval)
     return keyval;
   else
-    /* just return the keyval unchanged, we couldn't figure
-     * out a way to make it a hex digit
+    /* No way to make it a hex digit
      */
-    return event->keyval;
+    return 0;
 }
 
 static gboolean
@@ -1116,6 +1115,8 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
   GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context);
   GSList *tmp_list;  
   int n_compose = 0;
+  gboolean have_hex_mods;
+  guint hex_keyval;
   int i;
 
   if (event->type == GDK_KEY_RELEASE)
@@ -1144,30 +1145,31 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
     if (event->keyval == gtk_compose_ignore[i])
       return FALSE;
 
+  have_hex_mods = (event->state & (ISO_14755_MOD_MASK)) == ISO_14755_MOD_MASK;
+  hex_keyval = canonical_hex_keyval (event);
+
   while (context_simple->compose_buffer[n_compose] != 0)
     n_compose++;
 
-  /* First key in sequence; decide if it's a 14755 hex sequence */
-  if (n_compose == 0)
-    context_simple->in_hex_sequence =
-      ((event->state & (ISO_14755_MOD_MASK)) == ISO_14755_MOD_MASK);
-  
   /* If we are already in a non-hex sequence, or
-   * the 14755 modifiers are not held down, filter all
+   * this keystroke is not 14755 modifiers + hex digit, don't filter 
    * key events with accelerator modifiers held down.
    */
-  if (!context_simple->in_hex_sequence ||
-      ((event->state & (ISO_14755_MOD_MASK)) != ISO_14755_MOD_MASK))
+  if ((n_compose > 0 && !context_simple->in_hex_sequence) || !have_hex_mods || !hex_keyval)
     {
       if (event->state &
           (gtk_accelerator_get_default_mod_mask () & ~GDK_SHIFT_MASK))
         return FALSE;
     }
   
+  /* First key in sequence; decide if it's a 14755 hex sequence */
+  if (n_compose == 0)
+    context_simple->in_hex_sequence = have_hex_mods;
+  
   /* Then, check for compose sequences
    */
   if (context_simple->in_hex_sequence)
-    context_simple->compose_buffer[n_compose++] = canonical_hex_keyval (event);
+    context_simple->compose_buffer[n_compose++] = hex_keyval ? hex_keyval : event->keyval;
   else
     context_simple->compose_buffer[n_compose++] = event->keyval;
 
@@ -1176,7 +1178,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
   if (context_simple->in_hex_sequence)
     {
       /* If the modifiers are still held down, consider the sequence again */
-      if ((event->state & (ISO_14755_MOD_MASK)) == ISO_14755_MOD_MASK)
+      if (have_hex_mods)
         {
           /* space ends the sequence, and we eat the space */
           if (n_compose > 1 &&
@@ -1228,7 +1230,7 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext   *context,
                                          PangoAttrList **attrs,
                                          gint           *cursor_pos)
 {
-  char outbuf[25]; /* up to 4 hex digits */
+  char outbuf[37]; /* up to 6 hex digits */
   int len = 0;
   
   GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context);